Parametric Polymorphism in the Go Programming Language
نویسندگان
چکیده
An extension to the Go language was developed that introduces parametric polymorphism in the form of generic functions. The changes to the language and the compiler needed to implement the type system extensions are discussed, and alternative implementation strategies are described. The resulting implementation of generic functions is backwards compatible with the existing Go standard and is consistent with the design goals of the language. The overhead of the current prototype implementation is assessed based on two commonly used programming patterns.
منابع مشابه
Unifying Interfaces, Type Classes, and Family Polymorphism
Parametric polymorphism and inheritance are both important, extensively explored language mechanisms for providing code reuse and extensibility. But harmoniously integrating these apparently distinct mechanisms—and powerful recent forms of them, including type classes and family polymorphism—in a single language remains an elusive goal. In this paper, we show that a deep unification can be achi...
متن کاملSemantics of Parametric Polymorphism in Imperative Programming Languages
Programming languages such as CLU, Ada and Modula-3 have included facilities for parametric polymorphism and, more recently, C++ and Java have also added similar facilities. In this paper, we examine the issues of defining denotational semantics for imperative programming languages with polymorphism. We use the framework of reflexive graphs of categories previously developed for a general axiom...
متن کاملParametric Types in Java { A Look At GenericJava
Sun is currently evaluating a number of proposals for adding parametric types to the Java programming language. This paper presents some experiences with types and type safety in the context of C, C++, and Java, and provides some opinions on GenericJava, the leading proposal for parametric types in Java.
متن کاملLightweight Functional Session Types
Row types provide an account of extensibility that combines well with parametric polymorphism and type inference. We discuss the integration of row types and session types in a concurrent functional programming language, and how row types can be used to describe extensibility in session-typed communication.
متن کاملBoxes Go Bananas: Encoding Higher-Order Abstract Syntax with Parametric Polymorphism (Extended Version)
Higher-order abstract syntax is a simple technique for implementing languages with functional programming.Object variables and binders are implemented by variables and binders in the host language. By using thistechnique, one can avoid implementing common and tricky routines dealing with variables, such as capture-avoiding substitution. However, despite the advantages this techn...
متن کامل